<?php if(!defined('PHPOK_SET')){die('<h3>Error...</h3>');}?><?php QG_C_TEMPLATE::p("global_head","","0");?>
<?php QG_C_TEMPLATE::p("right.css","","0");?>
<?php QG_C_TEMPLATE::p("right.head","","0");?>

<!-- 玩家管理 -->
<?php if($sysAct == "add" || $sysAct == "modify"){?>
<div class="table2" style="text-align:left;">
	<a href="admin.php?file=index">系统首页</a> &raquo;
	<a href="admin.php?file=usercity&act=list">玩家城池</a> &raquo;
	<?php if($sysAct == "add"){?>添加新城池<?php }else{ ?>编辑城池<?php } ?>
	<input type="button" value="城池列表" onclick="qgurl('admin.php?file=usercity&act=list')">
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<form method="post" action="admin.php?file=usercity&act=viewok&id=<?php echo $id;?>" onsubmit="return add_msg();">
<tr>
	<td class="left">城池名城：<span style="color:red;">*</span></td>
	<td class="right">
		<input type="text" name="c_name" id="c_name" value="<?php echo $rs[c_name];?>">
	</td>
</tr>
</table>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">所属玩家：<span style="color:red;">*</span></td>
	<td class="right">
		<input type="text" name="u_id" id="u_id" value="<?php echo $rsb[p_nickname];?>">
<span class="clue_on">[填写所属玩家的ID不是账号]</span>
	</td>
</tr>
</table>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">坐标X：</td>
	<td class="right">
		<input type="text" name="c_area" id="c_area" value="<?php echo $rs[c_area];?>">
	</td>
</tr>
</table>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">坐标Y：</td>
	<td class="right">
		<input type="text" name="c_area_x" id="c_area_x" value="<?php echo $rs[c_area_x];?>">
	</td>
</tr>
</table>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">总面积：</td>
	<td class="right">
		<input type="text" name="c_total_size" id="c_total_size" value="<?php echo $rs[c_total_size];?>">
	</td>
</tr>
</table>
</div>
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">未用面积：</td>
	<td class="right">
		<input type="text" name="c_size" id="c_size" value="<?php echo $rs[c_size];?>">
	</td>
</tr>
</table>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">黄金：</td>
	<td class="right">
		<input type="text" name="golds" id="golds" value="<?php echo $rsa[golds];?>" >
	</td>
</tr>
</table>
</div>
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">木材：</td>
	<td class="right">
		<input type="text" name="woods" id="woods" value="<?php echo $rsa[woods];?>" >
	</td>
</tr>
</table>
</div>
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">粮食：</td>
	<td class="right">
		<input type="text" name="rices" id="rices" value="<?php echo $rsa[rices];?>" >
	</td>
</tr>
</table>
</div>
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">铁矿：</td>
	<td class="right">
		<input type="text" name="ores" id="ores" value="<?php echo $rsa[ores];?>" >
	</td>
</tr>
</table>
</div>
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">总人口：</td>
	<td class="right">
		<input type="text" name="total_house" id="total_house" value="<?php echo $rsa[total_house];?>" >
	</td>
</tr>
</table>
</div>
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
<table width="100%">
<tr>
	<td class="left">地形：</td>
	<td class="right">
		<input type="text" name="c_land_type" id="c_land_type" value="<?php echo $rs[c_land_type];?>" >
		<span class="clue_on">[填写代码：1（平原）,2（沃土）,3（森林）,4（山岳）,5（丘陵）]</span>
	</td>
</tr>
</table>
</div>



<?php $button_msg = $sysAct == "modify" ? "编辑城池" : "添加玩家";;?>
<div class="table">
<table width="100%">
<tr>
	<td class="left"></td>
	<td class="right"><input type="submit" id="creat_button" class="mybutton_01" value="<?php echo $button_msg;?>"> &nbsp; <span id="show_step" style="color:red;"></span></td>
</tr>
</form>
</table>
</div>
<script type="text/javascript">
function add_msg(msg)
{
	var username = $("username").value;
	if(!username)
	{
		alert("账号不允许为空");
		return false;
	}

	$("show_step").innerHTML = "<img src='admin/tpl/images/loading.gif' border='0' align='absmiddle'> 正在保存数据，如果网页没有动静请刷新...";

	$("creat_button").disabled = true;
}
</script>

<?php }elseif($sysAct == "list"){ ?>
<div class="table2" style="text-align:left;">
	<a href="admin.php?file=index">系统首页</a> &raquo;
	玩家城池
	<input type="button" value="添加新城池" onclick="qgurl('admin.php?file=usercity&act=add')">
</div>

<div class="table">
	<table cellpadding="1" cellspacing="0">
	<form method="post" action="admin.php?file=usercity&act=list">
	<tr>
		<td><input type="text" name="keywords" id="keywords" value="<?php echo $keywords;?>"></td>
		<td>
			<select name="stype" id="stype">
			<option value="c_name"<?php if($stype == "c_name"){?> selected<?php } ?>>城池名</option>
			<option value="c_id"<?php if($stype == "c_id"){?> selected<?php } ?>>城池名ID</option>
			<option value="u_id"<?php if($stype == "u_id"){?> selected<?php } ?>>城主名</option>
			</select>
		</td>
		<td>
			<input type="submit" value="搜索" class="mybutton_01">
		</td>
		</form>
	</tr>
	</table>
</div>

<table width="100%" cellpadding="0" cellspacing="0">
<tr>
	<td style="border-bottom:1px #D4D4D4 solid;"><img src="admin/tpl/images/blank.gif" border="0" width="1" height="1"></td>
</tr>
</table>

<table width="100%" cellpadding="0" cellspacing="0">
<tr class="table table2">
	<td height="23px" class="msg_subject_id b_b">城池ID</td>
	<td class="msg_subject b_b">城池名</td>
	<td class="msg_subject b_b">城主id</td>
	<td class="msg_subject b_b">坐标X</td>
	<td class="msg_subject b_b">坐标Y</a></td>
	<td class="msg_subject b_b">面积</td>
	<td class="msg_subject b_b">地形</td>
	<td class="msg_postdate b_b">操作</td>
</tr>
<?php $_i=0;$rslist=(is_array($rslist))?$rslist:array();foreach($rslist AS  $key=>$valuea){$_i++; ?>
<tr class="m_out" onmouseover="this.className='m_over'" onmouseout="this.className='m_out'">
	<td height="25px" align="center" class="b_b"><?php echo $valuea[c_id];?></td>
	<td align="left" class="b_b"><?php echo $valuea[c_name];?></td>
	<td align="left" class="b_b"><?php echo $valuea[u_id];?></td>
	<td align="left" class="b_b"><?php echo $valuea[c_area];?></td>
	<td align="left" class="b_b"><?php echo $valuea[c_area_x];?></td>
	<td align="left" class="b_b"><?php echo $valuea[c_total_size];?></td>
	<td align="left" class="b_b"><?php if($valuea[c_land_type] == "1"){?>平原<?php }elseif($valuea[c_land_type] == "2"){ ?>沃土<?php }elseif($valuea[c_land_type] == "3"){ ?>森林<?php }elseif($valuea[c_land_type] == "4"){ ?>山岳<?php }elseif($valuea[c_land_type] == "5"){ ?>丘陵<?php } ?></td>
	<td align="center" class="b_b">
		<input type="button" value="编辑" class="mybutton_01" onclick="qg_modify(<?php echo $valuea[c_id];?>)">
		<input type="button" value="删除" class="mybutton_01" onclick="qg_delete(<?php echo $valuea[c_id];?>)">
	</td>
</tr>
<?php } ?>
</table>
<div align="right"><?php echo $pagelist;?></div>
<script type="text/javascript">
function qg_modify(id)
{
	window.location.href="admin.php?file=usercity&act=modify&id="+id;
}
function qg_delete(id)
{
	//判断是否删除
	question = confirm("确认删除该信息吗？特别说明，删除后无法恢复！");
	if (question != "0")
	{
		qgurl("admin.php?file=usercity&act=delete&id="+id);
	}
}
</script>
<?php } ?>